package com.zx.repository;

import com.zx.entity.Food;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface FoodRepository extends JpaRepository<Food,Integer> {
    List<Food> findAllByCategoryId(Integer categoryId);

    List<Food> findAllByUserId(Integer UserId);

    Page<Food> findAllByUserId(Integer UserId, Pageable pageable);

    @Query("from Food where title like %?1% or foodName like %?1%")
    List<Food> findByKeyword(String keyword);
}
